﻿// JScript 文件

    function btNextClick() 
    {    
        if(document.getElementById("txtCustomerNo").value=="")
        {
            alert("请输入会员编号！");
            return false;
        }
        if (document.getElementById("txtCustomerName").value == "")
        {
             alert("请输入会员名称！");
             return false;
        }
        if (document.getElementById("txtbirthday").value == "")
        {
             alert("请输入出生年月！");
             return false;
        }
        
        if(document.getElementById("hAction").value == "Add")
        {
            if (document.getElementById("txtRePassWord1").value == "" || document.getElementById("txtPassword1").value == "")
            {
                 alert("一级密码不能为空！");
                 return false;
            }
            if (document.getElementById("txtPassword2").value == "" || document.getElementById("txtRePassWord2").value == "")
            {
                 alert("二级密码不能为空！");
                 return false;
            }
        }
        
        if(document.getElementById("pDetail").style.display =="block")
        {         
            if(document.getElementById("tbCustomerNO").value == "")
            {
                alert("经办人不能为空！");
                
                return false;
            }
            
            return  confirm("确定要保存吗？");
        } 
        else
        {
            document.getElementById("pDetail").style.display ="block";
            document.getElementById("pMaster").style.display ="none";

            document.form1.btPre.style.display="block"; 
            return false;
        }
    }
    
    function btPreClick() 
    {
        document.getElementById("pDetail").style.display ="none";
        document.getElementById("pMaster").style.display ="block";
          
        return false;
    }
    
    function ddlProvinceonChange()
    {
        var index = document.form1.ddlProvince.selectedIndex;  
        var value = document.form1.ddlProvince.options[index].value;

        BLL.CommBLL.GetCity(value,ddlProvinceonChange_callback);
    }

    function txtCustomerNoChange()
    {
        BLL.CustomerBLL.isExitCustomerNo(document.form1.txtCustomerNo.value,txtCustomerNoChange_callback);
    }

    function txtCustomerNoChange_callback(res)
    {
        if(res.value!=0)
        {
            alert("该账号已经存在");
            document.form1.txtCustomerNo.value="";
        }
    }
    
    function ddlProvinceonChange_callback(res)
    {
        var dt = res.value;  
        document.form1.ddlCity.length=0;
        for(var i=0; i<dt.Rows.length; i++)
        {
            var name=dt.Rows[i]["Name"];             
            var id=dt.Rows[i]["ID"];
            
           document.form1.ddlCity.options.add(new Option(name,id));
        }
    }

